RemoveDuplicatesInPlace Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Remove subsequent consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static void RemoveDuplicatesInPlace<T>(
	IList<T> list,
	IEqualityComparer<T> equalityComparer
)
Visual Basic (Declaration)
Public Shared Sub RemoveDuplicatesInPlace(Of T) ( _
	list As IList(Of T), _
	equalityComparer As IEqualityComparer(Of T) _
)
Visual C++
public:
generic<typename T>
static void RemoveDuplicatesInPlace (
	IList<T>^ list, 
	IEqualityComparer<T>^ equalityComparer
)

Parameters

list
IList<(Of <T>)>
The list or array to process.
equalityComparer
IEqualityComparer<(Of <T>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Type Parameters

T

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also